<template>
	<view class="content">
		<view class="drop" v-show="clickShow">
			<view class="shape"></view>
			<view class="dropItem">
				<image src="../../static/tabimg/mima.png" class="imgCode"></image>
				<view @tap="changepass">修改密码</view>
			</view>
			<view class="dropItem">
				<image src="../../static/tabimg/tuichu.png" class="imgCode2"></image>
				<view @tap="close">退出应用</view>
			</view>
		</view>
		<view class="uni-tab-bar">
			<!-- 主体导航 -->
			<view class="swiper">
				<view class="Roughing">
					<view class="stovebox">
						<view class="itemhead num">{{rollingnum}}</view>
						<view class="itemMain">
							<view class="itemMain-body">
								<view class="bodyitem" v-for="(item,k) in row" :key="k" :class="(k%2==0)?'' : 'addcol'">
									<view class="parameterTitle">{{item.name}}</view>
									<view class="parameterNum">{{item.num}}</view>
									<view class="titleinfo unit">{{item.unit}}</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>	
	</view>	

</template>

<script>
	import {post} from '@/lib/Util.js'
	import { mapState , mapMutations } from 'vuex';
	export default{
		data(){
			return{
				proID:'',
				clickShow:false,
				rollingnum:'',
				row: [
					{
						name: '板坯号',
						num: '',
						unit: '/'
					},{
						name: '钢种',
						num: '',
						unit: '/'
					},{
						name: '炉号',
						num: '',
						unit: '[mm]'
					},
					{
						name: '产品厚度',
						num: '',
						unit: '[mm]'
					},
					{
						name: '产品宽度',
						num: '',
						unit: '[mm]'
					},
					{
						name: '目标厚度',
						num: '',
						unit: '[mm]'
					},
					{
						name: '目标宽度',
						num: '',
						unit: '[mm]'
					},
					{
						name: '板坯厚度',
						num: '',
						unit: '[mm]'
					},
					{
						name: '板坯宽度',
						num: '',
						unit: '[mm]'
					},
					{
						name: '板坯长度',
						num: '',
						unit: '[mm]'
					},
					{
						name: '板坯重量',
						num: '',
						unit: '[mm]'
					},
					{
						name: '核对时刻',
						num: '',
						unit: ''
					},
					{
						name: '装炉时刻',
						num: '',
						unit: ''
					},
					{
						name: '出炉时刻',
						num: '',
						unit: ''
					},
					{
						name: '下线时刻',
						num: '',
						unit: ''
					},
				],
			}
		},
		computed: mapState(['forcedLogin', 'hasLogin', 'userName']),
		methods:{
			//导航栏关闭应用事件
			...mapMutations(['logout']),
			close(){
				let _self = this;
				uni.showModal({
					title: '退出登录',
					content: '确定要退出吗？',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							_self.logout();
							// #ifdef APP-PLUS  
							plus.runtime.quit();
							// #endif 
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			},
			changepass(){
				uni.navigateTo({
					url:'/pages/changepass/changepass'
				})
			},
			async getstove(val){
				let data = {"db":"oracle","sql":"select * from V_FCE2_TS where MATID = '"+val+"' and pro_id="+this.proID};
				try{
					let res = await post('database/executeQuery',data)
					let result = res.data[0];
					this.rollingnum = result.MATID
					this.row[0].num = result.SLABNO
					this.row[1].num =result.STEELGRADE
					this.row[2].num =result.FCENO
					this.row[3].num =result.PRODUCTTHK
					this.row[4].num =result.PRODUCTWID
					this.row[5].num =result.COILTHK
					this.row[6].num =result.COILWID
					this.row[7].num =result.SLABTHK
					this.row[8].num =result.SLABWID
					this.row[9].num =result.SLABLEN
					this.row[10].num =result.SLABWET
					this.row[11].num =result.IDENTIFYTIME
					this.row[12].num =result.CHARGETIME
					this.row[13].num =result.DISCHARGETIME
					this.row[14].num =result.FINISHEDTIME
				}catch(e){
					uni.showToast({
						icon:'none',
						title:"请求超时",
					})
				}
			}
		},
		onLoad(val) {
			this.proID = uni.getStorageSync('proid')
			this.getstove(val.id)
		},
		onNavigationBarButtonTap(e) {
			if(e.float=="right"){
				this.clickShow = !this.clickShow;
			}
		}
	}
</script>

<style>
	.stovebox{
		background: #f2f2f2;
		height: 100%;
		border-radius: 25upx;
	}
	.num{
		color: #134199;
		border-bottom: 2upx solid #C1C2C6;
		box-sizing: border-box;
	}
	.unit{
		color: #505153;
		width: 10%;
	}
	.parameterTitle{
		width: 40%;
	}
	.parameterNum{
		width: 50%;
		color: #134199;
	}
</style>

